/**
 * Copyright (c) 2013-2022 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.client.protocol.convertor;


/**
 * 实现了Convertor接口，专门用于将对象转换为Boolean类型的类。
 * 该转换器的目的是判断传入的对象是否为非空，将非空对象转换为true，空对象转换为false。
 */
public class BooleanNotNullReplayConvertor implements Convertor<Boolean> {

    /**
     * 将传入的对象转换为Boolean类型。
     * 转换逻辑是判断对象是否非空，非空则返回true，空则返回false。
     * 这种转换方式适用于需要根据对象是否存在来判断逻辑的场景。
     *
     * @param obj 需要转换的对象，可以是任何类型的对象。
     * @return 如果obj非空，则返回true；如果obj为空，则返回false。
     */
    @Override
    public Boolean convert(Object obj) {
        return obj != null;
    }

}
